package com.acwing.partition36;

import java.io.*;

/**
 * @author rkc
 * @date 2022/7/18 10:35
 */
public class AC3537树查找 {

    private static final int N = 1010;
    private static int[] w = new int[N];
    private static int n, k;

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = nextInt();
        for (int i = 0; i < n; i++) w[i] = nextInt();
        k = nextInt();
        int start = (1 << k - 1) - 1, end = start + (1 << k - 1);
        for (int i = start; i < end && i < n; i++) writer.print(w[i] + " ");
        if (start >= n) writer.println("EMPTY");
        writer.flush();
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
